<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Person{
            constructor(name,age){
                this.name = name
                this.age = age
            }
            speak(){
                console.log(`我叫${this.name},年龄为${this.age}`);
            }
        }

        class Student extends Person{
            constructor(name,age,grade){
                super(name,age)
                this.grade = grade
            }
            speak(){
                console.log(`我叫${this.name},年龄为${this.age}，我读${this.grade}`);
            }
        }
        const s1 = new Student('wtt',23,'研一')
        console.log(s1);
        s1.speak()
        // const p1 = new Person('wtt',23)
        // console.log(p1);
    </script>
</body>
</html>